﻿using System;
using SedionFormDesigner.Designer;
using System.ComponentModel;

namespace SedionFormDesigner.Infrastructure
{
    internal class SedionInheriteNameExtendProvider : SedionNameExtenderProvider
    {
        internal SedionInheriteNameExtendProvider(SedionDesignerHost host)
            : base(host)
        { }

        public override bool CanExtend(object extendee)
        {
            if (extendee == Host.RootComponent)
                return false;
            if (!TypeDescriptor.GetAttributes(extendee)[typeof(InheritanceAttribute)].Equals(InheritanceAttribute.NotInherited))
                return true;

            return false;
        }

        [ReadOnly(true)]
        public override string GetName(IComponent comp)
        {
            return base.GetName(comp);
        }
    }
}
